package sample;

import java.awt.Color;
import robocode.HitRobotEvent;
import robocode.HitWallEvent;
import robocode.Robot;

/**
 * @author Emerson Shigueo Sugimoto
 * @author Lucas Del Castanhel
 * */
public class RoboPrisioneiro extends Robot {
	public RoboPrisioneiro() { }
		
	public void run(){
		setBodyColor(Color.CYAN);
		setGunColor(Color.YELLOW);
		setRadarColor(Color.BLUE);
		setBulletColor(Color.green);
		setScanColor(Color.RED);
		
		while(true){
			turnLeft(getHeading() % 90);
			turnGunRight(90);

			while(true){
				turnRadarRight(360);
				turnRadarLeft(360);
				ahead(1000);
				turnRight(90);
			}
		}
	}
	

	@Override
	public void onHitRobot(HitRobotEvent e) {
		ahead(-10); //super.onHitRobot(e);
		turnLeft(20);
	}
	
	@Override
	public void onHitWall(HitWallEvent e) {
		//super.onHitWall(e);
		ahead(-10);
		turnLeft(20);
	}
	
}